Repo hygiene: untrack generated artifacts, fix stale doc paths#861
Conversation
Introduce KanataDefcfg as the only place that renders the kanata (defcfg ...) header, and route the four deterministic emitters through it: - KanataConfigurationGenerator (primary rule-collection generator) - ConfigurationService rule-based repair injection - SaveCoordinator crash-loop minimal-safe fallback - AppConfigGenerator include-file validation wrapper Previously each built the header by hand and had drifted: danger-enable-cmd and a consistent process-unmapped-keys value were present in some paths and absent in others, so the root daemon's command-execution posture depended on which code path last wrote the file. Named profiles (standard / minimalSafe / validationWrapper / repairFallback) now encode the intentional differences in one auditable place, and allowCommandActions is a single flag ready for a future user-facing gate. This is a byte-preserving extraction: render() reproduces the existing output for every emitter (verified against GoldenConfigs/default.kbd and home-row-mods.kbd). Adds KanataDefcfgTests pinning each profile's exact bytes. The AI config generator (KanataConfigGenerator) still hand-builds its header and is intentionally left for a follow-up, since changing it alters behavior. Note: built/tested in a Linux container without a Swift toolchain; relying on CI (golden + snapshot + new unit tests) to verify compilation and output.
KanataDefcfg uses only standard-library types; Foundation is not needed. Addresses automated review feedback on #859.
Address non-blocking review feedback on #859 (output-neutral): - render(): assert trailer begins with a newline when non-empty, and that managed-repeat delay/interval are both set or both nil — both are currently unreachable footguns, now guarded. - standard(): requirePriorIdleMs is now Int? (nil = omit) instead of using a magic 0 sentinel at the factory boundary; the caller maps its 0 sentinel. - Document that minimalSafe/validationWrapper render identically by design and that allowCommandActions:false omits danger-enable-cmd (kanata defaults off). - Trim the redundant generator comment to keep only the non-obvious rationale. - Add testMinimalSafeAndValidationWrapperShareOutputByDesign. Rendered output is unchanged for every emitter (asserts hold for all inputs; 0->nil mapping preserves prior behavior). Golden/unit pins still apply.
Review noted the render() assert is debug-only, so it can't protect a release daemon if a caller half-pairs managed-repeat delay/interval. Take them as a single (delayMs, intervalMs)? tuple in KanataDefcfg.standard() so the only real construction path cannot half-set them. Stored properties stay Int? to preserve Equatable synthesis; the assert remains as a debug backstop for the internal init. Output is unchanged (tuple maps to the same two optionals).
Audit quick wins (no code changes): - Untrack 24 MB of committed build artifacts (coverage/, coverage-full/, search-index.json) and add .gitignore guards. These regenerate in CI and nothing references them. - Remove the accidental literal '~/Library/Application Support/KeyPath/keypath.kbd' directory committed at the repo root (a script/test that didn't expand $HOME), and add a /~/ .gitignore guard so it can't recur. - CONTRIBUTING.md: replace the absolute /Users/malpern/... SECURITY.md link with a repo-relative one, and correct the stale 'I Want To...' file pointers to the current module layout (Sources/KeyPath/* -> Sources/KeyPathAppKit/*, KeyPathCore, KeyPathInstallationWizard). ContentView/SystemStatusChecker no longer exist; point at their successors. - CLAUDE.md: fix the stale note about a non-existent Tests/KeyPathAppKitTests/ directory; list the four real, compiled test targets. Remaining CONTRIBUTING staleness (architecture prose mentioning ContentView/ KanataManager, and the Sources/KeyPath/ directory tree) is left for a focused docs refresh.
Code Review — PR #861: Repo hygiene: untrack generated artifacts, fix stale doc pathsTL;DR: Clean, well-scoped hygiene PR. All factual claims verified against the repo. No code changes, no risk. One minor suggestion. OverviewThis PR does exactly what it says: removes 24 MB of generated artifacts from tracking, deletes an accidental tilde-literal directory, and corrects two documentation files. No Swift source changes. .gitignoreGood:
Minor suggestion: CLAUDE.mdThe fix is correct. Verified:
The new phrasing is accurate and more useful to a contributor trying to run tests. CONTRIBUTING.mdEvery path change was verified against the current source tree:
Scoping the deeper CONTRIBUTING.md prose cleanup (architecture section still naming Deleted filesRemoval of 8 generated files (coverage reports + JSON + search index + accidental directory) is appropriate. These regenerate in CI and were causing unnecessary repo bloat. The VerdictApprove. The one actionable item is the |
Audit "quick win" cleanup (QW1–QW3). No code changes — only
.gitignore, two docs, and untracking generated files.What & why
Untrack 24 MB of generated artifacts (
coverage/,coverage-full/,search-index.json) and add.gitignoreguards. They regenerate in CI, nothing in the repo references them, and they bloat every clone.Remove the accidental tilde directory. A literal
~/Library/Application Support/KeyPath/keypath.kbddirectory was committed at the repo root — the result of a script/test writing a~/...path without expanding$HOME. Removed, with a/~/.gitignoreguard so it can't recur. (No code path recreates it today; verified.)CONTRIBUTING.md:/Users/malpern/local-code/KeyPath/SECURITY.mdwith a repo-relative one.Sources/KeyPath/*layout to the current modules. Each new path is verified to exist.ContentViewandSystemStatusCheckerno longer exist — pointed at their successors (App.swift+UI/, andSystemInspector.swift+WizardStateMachine.swift).CLAUDE.md: Fix the note claimingTests/KeyPathAppKitTests/exists and is "NOT compiled" — that directory doesn't exist. Replaced with the four real, compiled test targets.Scope / not included
The deeper
CONTRIBUTING.mdstaleness — the architecture prose still namingContentView/KanataManager, and theSources/KeyPath/directory tree — is intentionally left for a focused docs refresh rather than bundled into this hygiene pass, to keep the diff verifiable.Note: the 24 MB stays in git history (this only stops future tracking); a history rewrite isn't worth it pre-1.0.
https://claude.ai/code/session_01Rso6kv5BgJrBCHxNWH4h7P
Generated by Claude Code